Socket
Socket
Sign inDemoInstall

keanu

Package Overview
Dependencies
235
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    keanu

Attempt at the Actor Model in javascript


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Lol wat

You create modules of rules with no state. You spawn a process (not an actual process yet) that can be sent messages.

// from the bank_account_example in the tests directory

// BankAccount is the module
// receive is BankAccount.receive
//   - type: message -> state -> state
//   - it gets passed the message and the current state
//   - it returns the new state
// [] is the initial (seed) state
let account = spawn(BankAccount, "receive", [])

send(account, ["deposit", 50])  // send account a message of deposit 50
send(account, ["withdraw", 30]) // send account a message of withdraw 30

// pid_of_other_process will be sent ["balance", 20]
send(account, ["check_balance", pid_of_other_process])

Exampls

In Test Directory

  • Simple CQRS style bank account

TODO

  • Make send async
  • Make send concurrent
  • Can subscribe to changes in an actors state
  • Can unsubscribe from changes in an actors state
  • Supervisor layer for persistence
  • actor state is an immutable reference type (maybe something like a bitmap hash tries)

License

keanu is Copyright (c) 2015 James Hunter @cccc00 and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.

Keywords

FAQs

Last updated on 11 Oct 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc